import java.util.ArrayList;

public class ShoppingCart<N, P> {

    class Item<N, P> {
        public N ItemName;
        public P ItemPrice;

        public Item(N itemName, P itemPrice) {
            ItemName = itemName;
            ItemPrice = itemPrice;
        }
    }

    private ArrayList<Item<N, P>> cart;

    public ShoppingCart() {
        this.cart = new ArrayList<>();
    }

    public void addItem(N itemName, P itemPrice) {
        cart.add(new Item<>(itemName, itemPrice));
    }

    public void removeItem(N itemName) {
        Item<N, P> item = null;
        for (Item<N, P> itemTmp : cart) {
            if (itemTmp.ItemName.equals(itemName)) {
                item = itemTmp;
                break;
            }
        }
        if (item != null) {
            cart.remove(item);
            System.out.println(itemName + " Removed from your cart");
        } else {
            System.out.println(itemName + " not Found in your cart");
        }
    }

    public void checkout() {
        System.out.println("Items in your cart:");
        for (Item<N, P> item : cart) {
            System.out.printf("%s $%s%n", item.ItemName, item.ItemPrice);
        }
    }

    public static void main(String[] args) {
        ShoppingCart<String, Integer> myCart = new ShoppingCart<>();

        myCart.addItem("Bread", 10);
        myCart.addItem("Butter", 12);
        myCart.addItem("Banana", 5);
        myCart.addItem("Jelly", 15);
        myCart.addItem("Milk", 7);

        myCart.checkout();

        myCart.removeItem("Honey");
        myCart.removeItem("Jelly");

        myCart.checkout();

    }
}
